package com.sky.mapper;

import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查关联的套餐id
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsbyDishIds(List<Long> dishIds);

    /**
     * 批量增加套餐
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id找菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id =#{id}")
    List<SetmealDish> getBySetmealId(Long id);

    /**
     * 根据套餐id删除菜品关联表
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    void deleteById(long id);



}
